<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | 王勇程 <laughskydragon@qq.com>                         |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 签到管理控制器
 */
class Checkin extends AdminBase
{

    /**
     * 签到列表
     */
    public function checkinList()
    {
        $where = $this->logicCheckin->getWhere($this->param);
        
        $this->assign('list', $this->logicCheckin->getCheckinList($where));
        
        return $this->fetch('checkin_list');
    }
    
    /**
     * 签到规则设置
     */
    public function rules()
    {
        IS_POST && $this->jump($this->logicCheckin->checkinRules($this->param));
        
        $this->assign('rules', $this->logicCheckin->getCheckinRules());
        
        return $this->fetch('checkin_rules');
    }
    

    
    /**
     * 签到详情
     */
    public function detail()
    {
        $info = $this->logicCheckin->getCheckinInfo(['id' => $this->param['id']]);
        
        $this->assign('info', $info);
        
        return $this->fetch('checkin_detail');
    }
    
    /**
     * 签到统计
     */
    public function stats()
    {
        $this->assign('stats', $this->logicCheckin->getCheckinStats($this->param));
        
        return $this->fetch('checkin_stats');
    }
    
    /**
     * 签到导出
     */
    public function export()
    {
        $where = $this->logicCheckin->getWhere($this->param);
        
        $this->logicCheckin->exportCheckinList($where);
    }
    
    /**
     * 签到奖励设置
     */
    public function rewards()
    {
        IS_POST && $this->jump($this->logicCheckin->checkinRewards($this->param));
        
        $this->assign('rewards', $this->logicCheckin->getCheckinRewards());
        
        return $this->fetch('checkin_rewards');
    }
    
    /**
     * 连续签到设置
     */
    public function continuous()
    {
        IS_POST && $this->jump($this->logicCheckin->continuousSettings($this->param));
        
        $this->assign('settings', $this->logicCheckin->getContinuousSettings());
        
        return $this->fetch('checkin_continuous');
    }
}